Fixed check for code to only check if method exists