Fixed incorrect usage of return statements