bugfix and test