Fix bug in inverse warping and add test case