Defining a function after an if statement causes "Compilation error on line 11 : Branch target not found: $0"