A little better error checking.