Fixed a crashing bug