write correct return code