bugfix; code cleanup