Further improved filename detection
Fixed bug in link cleaning