Fix possible problems
We need to make sure that the method will end at some point, even if the echo command is not present. Otherwise everything could hang. Also make it compatible with bad shells and make sure that ALL cached data is read and cleared