[fix] return error on empty result

This avoids the error of the form Cannot read property X of undefined
closes #15 #18 #19