Small bugfix and adding test suite