fixed logging and some minor other fixes