fixed bugs in PhotoDao. Tests for PhotoDao now OK.