more unit tests and bugfix for retrieving max value