fix flaws on my handling logic
formatting