Added an extra function check to prevent crashes in Safari 2. Fixes #3039.