Fix saving directory bug