use naked return in getMode function