fixed calculation order