Fixed notices and errors