Fix javascript errors