created check for undefined vars