more informative error
minor improvement to impl