Improve error handling and fixing all