fixed bug in autobuild function