improved implementation of ssh-agent fix