Fixing weird exceptions