Build system fixes/improvements