Fixed a bunch of bugs in the shader