Fixing test termination

Fixing test termination, as suggested in #331 by @hbeeken