fixed wrong equity function