Encoding fixed.And other small changes