Properly escape resources (fixes #70 and #69)