Fix a notice and a fatal error