Made build more stable and fixed a minor bug