transactions improve and bug fix