Debian patch

I've tried to make Craft on my Debian Wheezy, get some issues and handle it. You can find other info in commits. Hope i resolved this in a properly way.