Fixed bug in DocumentSession: Loading a managed entity with wrong type would give an InvalidCastException. Now null is returned as expected.