fix to compile

Solves issues #876 and #877