fixed some bugs, added calcMaxDrawdown.