bug fix that handle wrong file names and malformed urls