improve extraction - fixes #1
throw when wrong type