Fix bug in remap