Grain sorting and bar instability