fix bug of replaceById() method.
Null Pointer Exception if template 
having a empty div tag like "<div />" .