fixed bug with jason's code