better error handling when GPU memory is too small