Fixed onresume bug