better error logging and no-hatom-bug fixed