fixed regression introduced in 11e0ba1bde3a55e849e6f5be48aae4bbb85b0569 ("improved handling of assets when writing project files to disk").

also improved the asset handling code.