fixed an issue caused by endian
made Input/Output class abstraction