added low memory check