reviced c8d6a03 patch by using sys.argv instead of inspecting the frames