fixed some bugs, but still enabled debug mode