Fixed: use "if-else" replace "switch" for better performance

use "if-else" replace "switch" for better performance
use "if-else" replace "if"