Bug fixes and new define_adspot() function