that src_prepare() doesn't make sense. Move the code to global scope and drop the cd.