Fix bugs and code complete for 1.4.0.0