Fixed builder to_xs issue and stupidly merged code