Fixed bug that caused 'dirty' status to not be preserved.