adds proper log output and tf exception handling