Fix error-prone code and trim spaces from asset file names