Fix for GetEntityByKey bugs