What were the causes of the poor living conditions in cities during the late 1800s?