Fixed errors with bitmap memory.