Bug fix for the empty input case.