clean up and fix login bug