Minor JS fix. Declare variable before use