Fix a foolish error, add logging