removed unnecessary mkdir and added some debug code