Send headers when creating objects for libraries.

For libraries, create_objects() will now include all header files in the
request. Also fixed a couple of bugs where headers would not be included
correctly.