Prevent fatal error when handling objects