Fix errors when compiled with dart2js