Small bug fixes - mainly logging