totally stolen fix for flooding from @cobyism