fix crashing bug