Fixed corner bugs

Fixed #28