fix crashing problem