core: Make sure js boolean values are converted correctly.
(cherry picked from commit 3b3b24b8b5b4cea0997d7e287013eb31b25bb5b1)