add error messages and prevent fatal error