Transfer compile fixes from branch 'manual'