handling some edge cases