updated where condition, small fixes