Fix palette size computation bug