Fixing some edge cases