(hls backend with ram) replace connection.size with connection.safeSize