Fixed bug in rbmSampleK that was introduced in the refactoring of the code.