Improve edge case handling for lstrlen