fix panic when foreign_key == ""