Fixing array_flip errors