better error handling on atom generation