Slight optimization to getId methods
Fix a memory leak when bitmaps not released