fixes crash problem when press back key.