fixed bug in addWhere
created addFields function