fix compiling on freebsd
simplify constructors