fixed 'random' bug