fixed bugs in batch script