fix automatic resize to fit height if necassary

fixes #9 automatic resizing does not fit height when necessary