added more error information, fixed try catch