fix code so that layers with small fractins could be read out