#88: improved build process
some cleanup and fixed bugs