in your code after calling szGlobalAddAtom you return true all the time. You should check the return value. It could return an atom or 0 in case of an error so correct would be

Code:
   Move (szGlobalAddAtom(sAtom)) to hAtom
   Function_Return (hAtom <> 0)