removed some debug output, fixed index error