Optimal portfolio selection in stochastic environment