fix most of the compiler warnings

except strict-aliasing warnings when using libev API
Should probably remove this comment too