Fixed coding errors

Applied code fixes based on forum posting documenting errors.