changed to check local size