some code clean... but still buggy