lots of compile fixes