fix photo count unexpectedly increasing bug