Fixed a bug, but debugging is far from finished