Properly handle empty prefix