believe this fixes #4441, the logic was messed up before.  Needs testing

Logic was wrong but I would also like another pair of eyes on this.