well you solved the first problem but now theres a new one
if i drop the whole stack in lets say 4 slot and i have 6 different items it will leave an empty slot and take away the last item/items