IDEA 13 fixes

I fixed all errors and most of warnings. 
I saw similar pull request so please choose one and update your official repo in JetBrains.