adding logging and fixing test