auto detect import type. fixes #134 and #92