bugfix and beautifications