divide by zero validation fix
add check if calculator state reset is needed