Fix type detection on dirty attribute routine. Closes #1182.