large bug / small fix, adds test case