Fixed the crashing issue