Fixing a bug that caused target values to be out of range