fix and optimize commit 3445d02638a5ee173c237a55341e36576405b8cc
add a missing case statement