improved the bldapp script