tools doesn't crash anymore. produces wrong output though