More logging lines, fixed bug