Updated to handle string errors