add logging, small fixes