Fixed the critical bugs.