Bug & warning fixes

Fixes #890 
Fixes some warnings when building apps. (not all of them)