improve transpiling core javascript functions. fixes #1