fixes by vamanea, and remove debug