Misc fixes. (syntaxical and mem leak fix)