fixed minor corner cases