Fix bug with custom getElementById function