remove previous objects from array and dictionary when come to foreground