Add argument checks to several functions