fixed warnings and bugs in code
Merge remote-tracking branch 'origin/develop' into develop