make RegisterSingleton take a T

fixes #2282