Fixes and error handling