fix bad switch
optimization