made CalculatePrice more robust