Avoid unnecessary dynamic casting