add in error checking