added error handling for sarray size limit