tweaking; fixed debugging code