Measurement crash fixes

The length calculation of the sweep length to be returned had an error
of 1.
And the initialization of Y did not ensure an integer as length
determinator.