Fixing bug with ~