Fixing bug in gapfilling