stabillity function