Fix some compiler warnings (implicit casts, wrong return datatypes)