Add error checks to fix runtime error
Add error checks to fix runtime error

Signed-off-by: Trevor Porter <455d864f53b09d70b2d5550c0258d6765f92444a@ucdavis.edu>

manoj535/distribution,manoj535/distribution