Build fix and minor improvements