modified procedures_defreturn to be able to check the type of the return value