Test for #249
some work for #60
fix #249 by creating objects lazily if needed