small change to check if elements has length before binding data