Fix some bugs in base