does not crash, but ouput is incorrect