add support for min and max
fixing stuff