weird js type bug