Fix a crashing bug