added a conditional for empty string, fixes #518