fixed bug in decorator function