check for arguments before iterating
handle nil arguments properly