added empty check, fixes #1