Fixing zBuffer and edge cases.