shader and fixes for OSX