Fixed code mistakes