Add -t option, fix bug in small palette mask reading