pixel.c cleanup and bugfixes