Prevent error when running -r from a script
Added timeout in several functions
Fixed sudo prompt regex