hey, thanks for posting this -- i know you commented this a long time ago, but i was hoping to get some clarification, if you dont mind, since im having this problem.
when you say "add !is_undefined(...)", where are you actually putting it? i tried to use this solution and i couldnt quite figure it out.