bugfix and passing test