Fix some market bugs and add more warnings