Fixing a very obvious Null-Pointer-Exception
Add type-safety by inferring actual classes and adding them to
declarations.