Fix timing issue with setting modes

@javruben