Fix some bugs and expand smoke test