added a safestrip function to loginscript