fix conditional bug