Similar to the changes made in #467
Similar to the changes made in #467