bugfix
improve and flexibilise