fixed passing custom data to a model constructor; fixed as_object() instantiations not cached

thanks for @keigoi for spotting the custom data issue (see #332)