Fix some logic bugs - this works just fine with jQM-recent