error catching and minor fixes
error catching and minor fixes
minor fixes