added better error messages