made onbackgroundClicked more robust