fixed some issues in the build routine