added some more resiliency for corner cases