fix order of variable declaration