US5987: Properly handle the edge cases