imported from cinnamon-git and fixed compiling issues