fixed server-side transaction logic