fixed a few issues I noticed on some forked version.