Fixed a bug in the previous layout implementation.