fix crash on invalid target