protocols.c: Fixed invalid writes