improved logging for debugging purposes