New test and some minor fixes