trying to fix bitmap memory problem