Fixed handling of REJECT return code.

(cherry picked from commit 8e42553e44be1b054d2f6e9b84b3632e83e4a0bd)