Error logging fix