fix #378

Sorry for a mess, I didn't created a new branch for the previous request #374, so they got merged together.