Add index
Error habdling
Another fix