Code

fix several non-portable hacks