Fix height calcuation bug