more fixes, added logging ability