fixed nasty bug in the flux calculation