error check to prevent a possible crash