Fix session handling
Don't set dirty if it's already set