Small fixes + cleanup
(cherry picked from commit 61cba30)