fixed compiler warnings and freebsd problem