added nil check for argument to script