fixed bugs in casting procedure - making normals consistent after flipping was key