for some reason the old code was causing vim to segfault