Fixed two errors in javascript loading