Undefined vs 0 js bug