changed libraries, added database argument
changed broken pipe error