Fixed excpetion error

and added the istarget method but not yet finished