fixed a crashing bug