fixed bug and changed bin function. should not overwrite pop bin