small bug fix for edge cases