namespace implementation, compile issue for php 5.4 and higher
fixed various compile issues and namespace implementation