Fixed issue where writeByte was called insted of writeInt()