fixed bugs, added batch