Fix some deep bugs and now app may be closed