Fix bug with statement position relative to if-statement