Properly log exception

This (unlikely) runtime exception causes weird problems.