bugfix in test
refact code