Fix for prev version: gallery from AJAX popups stacks content if it's switched before loading has finished (#219)