fixed crashing bug.