fix to logic