fixed one bug, added debug facility