Fixed code to work on php 5.4

Fixed cannot use function return value in write context error