Fix "val is undefined" error in case of value="-1" attribute