Fix ordering when field attribute is empty. Fixes #642