Fix return from functions with if’s