Tested and fixed wshd_check_output