Added null check on blur event