fixed the bugs of dans commit

and included his changes.