Fixed some bugs, added a new setObject convenience method