fixed bug in linear interpolation