Fix CHK_REDIRECT to work with non-gcc compilers