added testcase and reverted changes and prevent the php notice