better style to solve the bug