Fix most critical bugs