Bug Fix #4417,#4403: Single-clicking a foreign key causes JS error

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>