small cleanups, found a bug in paint.c