cat: use optional output port even when first argument is a port

The logic was a bit weird in this function.  A branch of the second if statement was entirely occluded by the first if statement.  It seems the intended functionality is to operate as this change implements.