readded the flip logic
fixed tile cloning bug