Fixed bug in WRITE_RESULT macro