Fix non-terminating unit tests