fixed bug in loading dataTable in a if-else loop