fix SyntaxError: return not in function