bug fixes for libkqueue