small fixes, thx to patrick and christian
added sample code