set max photos var to 1 when it is not set in database