Fixes based on comments by @jedmao