Fix issues based on @charlax review