Fix some bugs, some are remaining