Fixes if statement order