Fix memory and tile breaking bugs