Fixes bug with texture sampling