made update more conditional