Better solution for the previous BUG