Added error checking to the linking phase.