remove every hacks out there, properly detect shell and term