added better login on error