bug and style fix, added 'cd $srcdir' in prepare()