step_values: Improved mask handling

Stepped values follow unmasked values more closely before masked section
of data.