Fixing crash bug