check if code is valid and create a false output if code fails