move argc check to outside of function