Fixes based on @necolas feedback.