Fixed another bug, added debug state