fixed logging and some small changes