rewriten gems loading, added tests, closes #6