Added tests, one which exposes a bug