Fix segfault in pxa palette and avoid empty lines