Fixed crashing bug