Conditional Logic not working correctly in firefox