Added fixes to be able to run under tainmode