corrected more corner cases