undefined prototype issue fixed