fix for  undefined index errors

This fixes a couple of 'undefined index' errors I was seeing.