Fix assertion and JSHint errors.