fixed the wrong check (due to delayed expansion) in bat-template