Fix error handling and call order