corrected bugs $num