fix a crashing bug