reduce redundancy
do not call sprintf on undefined values to prevent warnings