fixed paint function