Fixed code to prvent notice level errors