simplify some code and remove a frequent, unnecessary null pointer check in the generated javascript