bugs fix in three batch scripts