html handling improvement