add more robust error checking