fix behavior when dict is empty, add support for long string