added safeMode to getAttribute