fixed bug with transaction