Fixing minor crashes