optional passing in of basedir (global variable foo doesn't work with inheritance)