fixed crashing bug