Fix bug with injector not detecting and calling closures for dependencies, add unit tests