Fixed a bug involving the final positions

Final positions were not shifted by one in all matching cases.