html decoding and bug fixes