Fix libevent linking

Closes #1080