Fix for #2

Added checks to address #2.