applied patch from Stefan Sobernig and added safe.tcl provided by him