adding some encoding checks