Fixing 27841 and 27846

This PR fixes issues 27841 and 27846.