Fix nearest neighbor and linear filtering