Fixed issues discovered by siph0n