Fixing empty prefix bug