Simplify some code

Signed-off-by: leo-ma <begeekmyfriend@gmail.com>