updated build process to be more robust