Clean up photo/audio id refs. Closes #329.