fixes and added unit-tests in log-det