fixing corner cases