Fix issue with length detection of result length