buildMessage should only add metadata if there are metadata keys

This is a fix for issue #4