adapted pullrequest #33 from original repo