fixed bug with optimized constructor, removed duplication on server side