Fixed return value problem on 64bit systems and other cleanup.

* Erased multiple compilation warnings and problems.