Registered handle_deinit callback and corrected TOTAL_IMAGE_SLOTS.