misc. fixes

fix various misc. problems.
Big one is the fact that gcc 4.8 does not have <codecvt> header.