Fixed bugs found be the inspector.