clean a little problematic piece of code