fixed bug that caused crash when negative number of bins was calculated; this change stops the crash but doesn't fix the problem of why they were calculated negative in the first place