Various fixes to correctly support builds for two architectures