Fixing issues as pointed out by Dave