removed WRITE_SHADER_DEBUG option
Made caching more robust.