Fixing horrible bugs