fixed a bug detecting the type of the link