Fixed logging that was causing exception