fixed bug causing crash