Fix null pointer issue when attrs are not supplied to withTag

This fixes as issue where the attrs attribute of the attrs parameter to the closure is not provided and a NullPointerException occurs. Unit tests included.