Fixed populate menu function