added conditional test of css class exist