Fixed bug in generating bins