Are you sure this works ? 

If nsalias is not null, you're currently looking for nsalias in the store, not the layer name.