layout returns pnothing at end