Fixed endianess and logging issues