Fix some bugs related to previous test, but test still fails