Better bitmap memory handling