Fixing the javascript error.
Added conditions for table columns