Fixed errors with the 'both'-function