Fixed bug when photos were added to database twice.
Fixed some bugs.
Initial