bagfix, tests improvements