Fix another rollback issue with module ending
Add test for rollback in module case