Fix log messages
Handle TypeError