added reset protection