minor nits
more error checking