Fixes license header and adds stable sort

For #1234.