fixed bug when rendering md in a subdirectory
fixed cleanup