Fix bug and remove debug output