Fixed an intermittent segfault