Updates of error handling and small linting fixes