fix some bugs in webworker and brain