fixed a small bug may lead to crash