Remove some warnings

Small refactor based on static analysis