integrate compile fixes from Joshua's PR