added logging in more places