unit testing
fixes based on unit tests