get rid of several dirty hacks
Merge pull request #511 from chrox/master

get rid of several dirty hacks