better handle transaction to avoid disappearing cursor