Added some defensive programming to SeqUtil and SetUtil classes