fixes, add some basic tests, key import