minor bug fixes to remove randomness