Fixes some javascript errors, esp. when minifying javascript