Some fixes

1. For collection variables, it should be initiated before use.
2. Resolved infinite loop when appending table builder.
3. Added ResourceManagmentUtils class to control close resource.