Fixed path, constants and added file_put_content replacement