Fixed document saving