fixed a typo and alerts if an error happens