further fixes and improvements in build system