fix waitRead and waitWrite primops