[FIX] Fixed a lookup problem as well as a cast problem in one of the tes...

...ts.