Fixed a bug where long type was not encoded properly