Backport arel fix

Closes #11870

This is a backport of d345ed40b5783ec2cb43f4434872ea5b2d57d203 and 77ba336080b4de15233f669bdeea5c9ac44a3941