compilation fixes and other misc tweaks