Bugfixes for undefined reference error