fix a bug and removing debug leftovers