better dirty management in sessions