Fixed function for works.php