Fix issues mentioned in PR