small updates and error handling